# -*- coding:utf-8 -*-
from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import List, Literal, Optional, Union

from pydantic.v1.validators import int_validator
from zope.interface import Invalid

from module_admin.annotation.pydantic_annotation import as_query


class BgFileModel(BaseModel):
    """
    表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True, populate_by_name=True)
    category_id: Optional[int|str] =  Field(default=None, description='文件分类')
    cover: Optional[str] =  Field(default=None, description='封面')
    create_by: Optional[int] =  Field(default=None, description='创建者')
    create_time: Optional[datetime] =  Field(default=None, description='创建时间')
    del_flag: Optional[str] =  Field(default=None, description='删除标志')
    dept_id: Optional[int] =  Field(default=None, description='部门id')
    detail: Optional[str] =  Field(default=None, description='详情')
    file_size: Optional[str] =  Field(default=None, description='文件大小')
    id: Optional[int] =  Field(default=None, description='id')
    mark: Optional[str] =  Field(default=None, description='描述标记')
    name: Optional[str] =  Field(default=None, description='文件名称')
    update_time: Optional[datetime] =  Field(default=None, description='更新时间')
    video: Optional[str] =  Field(default=None, description='视频')
    file_url: Optional[str] =  Field(default=None, description='文件URL')
    file_type: Optional[str] =  Field(default=None, description='文件类型')
    download_count: Optional[int] =  Field(default=0, description='下载次数')
    is_vip: Optional[bool] =  Field(default=True, description='是否VIP专享')



@as_query
class BgFilePageModel(BgFileModel):
    """
    分页查询模型
    """
    page_num: int = Field(default=1, description='当前页码')

    page_size: int = Field(default=10, ge=0, le=10, description='每页记录数')


